<?php

namespace app\index\service;

use app\common\model\Account;
use app\index\dao\AccountDao;
use app\index\model\UM as UM;

/**
 * Class AccountService
 * @package app\index\service
 */
class AccountService
{
    // dao
    private AccountDao $accountDao;

    public function __construct(AccountDao $accountDao)
    {
        $this->accountDao = $accountDao;
    }

    /**
     * 查询
     * @param UM $user
     * @return Account
     */
    public function read(UM $user): ?Account
    {
        $id = $user->id;

        return $this->accountDao->find($id);
    }
}
